package com.kingyea.mobilepolice.kim.utils;

import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

/**
 * kim MD5加密工具
 */
public final class MD5 {
    private static MessageDigest digest;

    public MD5() {
    }

    public static String encrypt(String text) {
        try {
            return Base64.encodeBytes(digest.digest(text.getBytes("UTF-8")));
        } catch (UnsupportedEncodingException var2) {
            throw new RuntimeException("unsupported encoding : UTF-8", var2);
        }
    }

    static {
        try {
            digest = MessageDigest.getInstance("MD5");
        } catch (NoSuchAlgorithmException var1) {
            throw new RuntimeException("MD5 Algorithm Not Supported", var1);
        }
    }
}
